<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>203-正则-原子筛选.html</title>
</head>
<body>
	<input type="text" id="txt" autocomplete="off">
	<button id="btn">发布</button>
	<ul id="list">
		
	</ul>
</body>
<script>
	/*
	var str = "zxc vbn jkl iop";
	var reg = /a/g;
	var reg1 = /d/g;
	var reg2 = /a|d|g/g;

	console.log(str);
	console.log(str.replace(reg,"*"));
	console.log(str.replace(reg1,"*"));
	console.log(str.replace(reg2,"*"));
	*/

	var oTxt = document.getElementById('txt');
	var oBtn = document.getElementById('btn');
	var oUl = document.getElementById('list');


	oBtn.onclick = function(){
		var oLi = document.createElement('li');
		var reg = /上衣|衬衫|T恤/g;
		oLi.innerHTML = oTxt.value.replace(reg,'*');
		oUl.appendChild(oLi);	
	}
</script>
</html>